package cn.kgc.controller;

import cn.kgc.dto.SearchParam;
import cn.kgc.dto.SearchResult;
import cn.kgc.service.EsSearchService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @description:
 * @author: 石浩杰
 * @date: 2022-12-13 11:42
 */
@RestController
@RequestMapping("/pms")
@Api(tags = "搜索商品控制器")
public class EsSearchController {
    @Resource
    private EsSearchService esSearchService;

    @PostMapping("/search")
    @ApiOperation(value = "ES搜索商品信息",httpMethod = "POST",produces = "application/json;charset=UTF-8",response = SearchResult.class)
    @CrossOrigin
    public SearchResult search(@RequestBody SearchParam searchParam){
        return esSearchService.search(searchParam);
    }
}
